$(function() {
	
	$.ajax({
		url: "http://120.27.209.174:1010/api/v1/posts_banner",
		success(res) {
			res.forEach(function(item, index) {
				console.log(item, index)
				$(`<div class="carousel-item ${ index === 0 ? 'active' : '' }">
				  <img src="${ item.image }" class="d-block w-100" alt="...">
				  <div class="carousel-caption d-none d-md-block">
					<p>${ item.text }</p>
				  </div>
				</div>`).appendTo(".my-banner .carousel-inner")
				
				$(`<li data-target="#carousel" data-slide-to="${index}" class="${ index === 0 ? 'active' : '' }"></li>`).appendTo(".my-banner .carousel-indicators")
			})
			
		}
	})
	
	
})


